<template>
	<view class="ljapp my-sign-patient">
		<view class="header u-flex">
			<u-search
				:showAction="false"
				shape="square"
				placeholder="搜索患者"
				placeholderColor="#999999"
				bgColor="#f6f6f6"
				@search="Onsech"
				>
			</u-search>
		</view>
		
		<view class="content">
			<view class="list">
				<view class="item u-flex" v-for="(item,index) in group.list" :key="index">
					<image class="avatar" :src="$base.cdn(item.user_headimgurl)" mode="aspectFill"></image>
					<view class="info u-flex-fill">
						<view class="tit u-flex u-flex-y-center">
							<view class="name">{{item.user_name}}</view>
							<view class="sex">女</view>
							<view class="age">29岁</view>
							<view class="mobile">15379846392</view>
						</view>
						<view class="tags u-flex">
							<view class="tag bg1">图文问诊<text>({{item.consultation_order_num}})</text></view>
							<view class="tag bg2">视频问诊<text>({{item.consultation_video_order_num}})</text></view>
							<view class="tag bg3">报告解读<text>({{item.consultation_report_order_num}})</text></view>
						</view>
						<view class="con">
							<view>图文问诊：不限</view>
							<view>视频问诊：不限</view>
							<view>报告解读：不限</view>
						</view>
						<view class="time">
							<view>签约时间：{{$u.timeFormat(item.starttime,'yyyy.mm.dd')}}</view>
							<view>有效期至：{{$u.timeFormat(item.endtime,'yyyy.mm.dd')}}</view>
						</view>
					</view>
				</view>
			</view>
			
			<lj-empty v-if="group.loaded&&group.list.length<=0">暂无签约患者</lj-empty>
			<view v-else>
				<u-loadmore
					:status="loading?'loading':(group.loaded?'nomore':'loadmore')"
					fontSize="28rpx"
					color="#d9d9d9"
					nomoreText="已加载全部"
					marginTop="30rpx"
					marginBottom="0"
					@loadmore="getList"
				></u-loadmore>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sech: '',
				funnel: 0,
				
				group:{
					page: 1,
					limit: 10,
					list: [],
					loaded: false,
				},
				loading: false,
			}
		},
		onLoad(options){
			if(options.funnel) this.funnel = options.funnel
			this.init()
		},
		methods: {
			init(){
				this.group.page = 1
				this.group.list = []
				this.group.loaded = false
				this.loading = false
			
				this.getList();
			},
			getList(){
				var that = this, group = that.group
				if(that.loading || group.loaded) return;
			
				that.loading = true
			
				this.$Http({
					url: 'doctorMySignPatientList',
					data: {
						page: group.page,
						limit: group.limit,
						sech: this.sech,
						funnel: this.funnel,
					},
					type:'POST',
				}).then(res=>{
					if(res.code == 1){
						var list = res.data.data;
						group.loaded = list.length < group.limit;
						group.page ++;
						group.list = group.list.concat(list);
					}
					
					that.loading = false
				}).catch(()=>{
					that.loading = false
				});
			},
			onReachBottom(){
				this.getList()
			},
			Onsech(e){
				this.sech = e
				this.init()
			}
			
		}
	}
</script>

<style lang="less">
	@import '@/pagesD/style.less';
	
	.my-sign-patient{
		padding-right: 26rpx;
	}
</style>
